﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AnaxibiaStudios.Smug.Advanced;

namespace AnaxibiaStudios.Smug
{
  public class Create
  {
    public static TargetType Proxy<TargetType>(params object[] args)
    {
      return ConfiguredProxy<TargetType>(ProxyConfiguration.Default, args);
    }

    public static TargetType ConfiguredProxy<TargetType>(ProxyConfiguration config, params object[] args)
    {
      return (TargetType)ProxyRepository.CreateInstance(typeof(TargetType), config, args);
    }
  }

  public class ProxyConfiguration
  {
    public static ProxyConfiguration Default
    {
      get
      {
        return new ProxyConfiguration
        {
          InvocationHandler = Internal.InvocationHandler.Default,
          UseRealMethodsInConstructor = false
        };
      }
    }

    public Internal.IInvocationHandler InvocationHandler { get; set; }
    public bool UseRealMethodsInConstructor { get; set; }
    public List<Attribute> ClassAttributes { get; protected set; }

    public ProxyConfiguration()
    {
      ClassAttributes = new List<Attribute>();
    }
  }
}
